package com.${companyName}.${artifactId}.dal.mybatis.enums;

public enum ${tableName?cap_first}${enumName}Enum {

	<#list enumValues as item>
	${item}("${item}", "${item}")<#if item_has_next>,<#else>;</#if>
	</#list>
	
	private String code;
	private String message;

	public static ${tableName?cap_first}${enumName}Enum getEnumByMessage(String message) {
		if (message == null)
			return null;
		for (${tableName?cap_first}${enumName}Enum _enum : values()) {
			if (_enum.getMessage().equalsIgnoreCase(message)) {
				return _enum;
			}
		}
		return null;
	}

	/**
	 * 获取全部枚举
	 * 
	 * @return List
	 */
	public static java.util.List<${tableName?cap_first}${enumName}Enum> getAllEnum() {
		java.util.List<${tableName?cap_first}${enumName}Enum> list = new java.util.ArrayList<${tableName?cap_first}${enumName}Enum>(values().length);
		for (${tableName?cap_first}${enumName}Enum _enum : values()) {
			list.add(_enum);
		}
		return list;
	}

	/**
	 * 获取全部枚举值
	 * 
	 * @return List
	 */
	public static java.util.List<String> getAllEnumCode() {
		java.util.List<String> list = new java.util.ArrayList<String>(values().length);
		for (${tableName?cap_first}${enumName}Enum _enum : values()) {
			list.add(_enum.getCode());
		}
		return list;
	}

	private ${tableName?cap_first}${enumName}Enum(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
}
